fix(capsule): 终态/空闲让胶囊点击穿透,修复贴近输入框误触弹主界面 (#631)#633
Merged
Conversation
胶囊窗口 220×110 远大于可见 pill,录音完成后 2s toast + 360ms 离场动画期间 透明区域仍会吃掉点击并激活 OpenLess(把主界面带到前台)。在 emit_capsule 主线程闭包按状态切换 set_ignore_cursor_events:Done/Cancelled/Error/Idle 点击穿透到下层应用;Recording/Transcribing/Polishing 保留 ✕/✓ 按钮可点。 按状态变化去重,录音中 ~30Hz 电平帧不重复调系统 API。Linux 分支不操作 胶囊窗口,不受影响。
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
H-Chris233
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
问题 (#631)
录音胶囊窗口为 220×110,远大于可见 pill(约 42px 高)。录音完成后胶囊有 2s toast 停留 + 360ms 离场动画,期间整个透明窗口区域仍响应点击。胶囊贴近输入框(如微信聊天窗)时,用户录完点击输入框易误触胶囊 → 激活 OpenLess → 主界面被带到前台,打断操作流。
修复
在
emit_capsule的主线程闭包中按状态切换set_ignore_cursor_events(这是胶囊状态变更的唯一漏斗):按状态变化去重(
AtomicBoolswap),录音中 ~30Hz 电平帧不会重复调系统 API。Linux 分支本就不操作胶囊窗口(fcitx5 aux 文本),不受影响。影响分析
GitNexus:
emit_capsule有 15 个直接调用方(dictation/QA/voice-agent 全部流程),hub 评级 CRITICAL。本改动不动签名、不动现有 show/hide/定位行为,仅附加一个状态驱动的窗口属性切换,对调用方透明。验证
capsule_ignore_cursor_only_in_non_interactive_states(穿透状态映射契约)cargo test --lib:479 passed, 0 failedCloses #631
PR Type
Bug fix
Description
Add state-based cursor ignore for capsule window
Prevent misclick when capsule near input box
Add deduplication to avoid redundant system API calls
Add test for state mapping contract
Diagram Walkthrough
flowchart LR A["CapsuleState"] --> B{"Interactive?"} B -- "Recording, Transcribing, Polishing" --> C["No ignore (clickable)"] B -- "Done, Cancelled, Error, Idle" --> D["Ignore cursor events (click-through)"] C --> E["User can tap ✕/✓"] D --> F["Click passes to underlying app"]File Walkthrough
capsule.rs
Implement state-based cursor ignore for capsule windowopenless-all/app/src-tauri/src/coordinator/capsule.rs
capsule_ignore_cursor_for_state()function to determine ifcapsule should ignore cursor based on state
CAPSULE_IGNORE_CURSOR_APPLIEDfor deduplicationemit_capsule, setset_ignore_cursor_eventsonly when state changestests.rs
Add unit test for cursor ignore state mappingopenless-all/app/src-tauri/src/coordinator/tests.rs
capsule_ignore_cursor_only_in_non_interactive_statestoverify state to ignore mapping